<template>
  <div class="home">
    <el-form :model="ruleForm" status-icon :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
      <el-form-item label="用户名称" prop="pass">
        <el-input type="text" v-model="loginForm.username" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="用户密码" prop="checkPass">
        <el-input type="password" v-model="loginForm.password" autocomplete="off"></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="login('ruleForm')">提交</el-button>
      </el-form-item>

    </el-form>
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'

export default {
  name: 'Login',
  data() {
    return {
      loginForm:{
        username:'zhangsan',
        password: '123456'
      },
      ruleForm:{

      },
      rules: {

      }
    }


  },
  methods:{
    login() {
      this.axios.post('user/login',this.loginForm).then(res=>{
        let token = res.data.data;
        localStorage.setItem("token", token);
        this.$router.replace('/hetong')
      })
    },

  },
  mounted() {

  }

}
</script>
